package com.project.config;

import com.project.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Title: WebConfig
 * @Package: com.project.config
 * @Description:
 * @Author: Liang-Xie
 * @Date: 2022/6/29 - 14:19
 */
@SuppressWarnings("all")
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())//注册拦截器
        .addPathPatterns("/dept/*");//定义拦截范围

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/face/**").addResourceLocations("file:D:\\JavaPlus\\javaWEB\\Interceptor\\src\\main\\resources\\static\\userface");
    }
}
